package com.firmboy.annotation.demo1;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.lang.reflect.Method;

/**
 * @author firmboy
 * @create 2018-06-19 下午3:20
 **/
@RestController
public class TestAnno {


    public static void main(String[] args){
        NoBug noBug = new NoBug();

        Class<? extends NoBug> aClass = noBug.getClass();


        Method[] methods = aClass.getDeclaredMethods();

        StringBuilder log = new StringBuilder();

        for(Method m: methods){
            if(m.isAnnotationPresent(MyTest.class)){
                try{
                    m.setAccessible(true);
                    m.invoke(noBug,null);
                }catch(Exception e){
                    e.printStackTrace();
                }

            }
        }

        System.out.println("测试完成");

    }


}
